<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>阿里宝宝 - 电商平台</title>
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/components.css">
    <link rel="stylesheet" href="css/responsive.css">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
</head>
<body>
    <!-- 顶部导航栏 -->
    <header class="header">
        <div class="container">
            <div class="header-content">
                <!-- Logo -->
                <div class="logo">
                    <a href="index.html">
                        <i class="fas fa-shopping-bag"></i>
                        <span>阿里宝宝</span>
                    </a>
                </div>

                <!-- 搜索框 -->
                <div class="search-box">
                    <input type="text" id="searchInput" placeholder="搜索商品... / Search products...">
                    <button id="searchBtn"><i class="fas fa-search"></i></button>
                </div>

                <!-- 用户操作区 -->
                <div class="user-actions">
                    <div class="user-menu" id="userMenu">
                        <button class="user-btn" id="userBtn">
                            <i class="fas fa-user"></i>
                            <span id="userName">登录 / Login</span>
                        </button>
                        <div class="user-dropdown" id="userDropdown">
                            <div class="dropdown-content">
                                <a href="#" id="loginLink">登录 / Login</a>
                                <a href="#" id="registerLink">注册 / Register</a>
                                <a href="#" id="profileLink" style="display: none;">个人中心 / Profile</a>
                                <a href="#" id="ordersLink" style="display: none;">我的订单 / My Orders</a>
                                <a href="#" id="logoutLink" style="display: none;">退出登录 / Login / Logout</a>
                            </div>
                        </div>
                    </div>
                    
                    <div class="cart-icon" id="cartIcon">
                        <a href="cart.html">
                            <i class="fas fa-shopping-cart"></i>
                            <span class="cart-count" id="cartCount">0</span>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </header>

    <!-- 主导航 -->
    <nav class="main-nav">
        <div class="container">
            <ul class="nav-list">
                <li><a href="index.html" class="active">首页 / Home</a></li>
                <li><a href="products.html?category=Food">食品 / Food</a></li>
                <li><a href="products.html?category=Clothing">服装 / Clothing</a></li>
                <li><a href="products.html?category=Book">图书 / Books</a></li>
                <li><a href="products.html?category=Electronic Products">电子产品</a></li>
                <li><a href="products.html?category=Daily product">日用品</a></li>
                <li><a href="seller-dashboard.html" id="sellerLink" style="display: none;">卖家中心 / Seller Center</a></li>
                <li><a href="admin-dashboard.html" id="adminLink" style="display: none;">管理员中心 / Admin Center</a></li>
            </ul>
        </div>
    </nav>

    <!-- 主要内容区域 -->
    <main class="main-content">
        <!-- 首页 / Home轮播图 -->
        <section class="hero-section">
            <div class="hero-slider">
                <div class="slide active">
                    <div class="slide-content">
                        <h2>精选好物，品质生活 / Quality Products, Quality Life</h2>
                        <p>发现更多优质商品，享受购物乐趣 / Discover quality products and enjoy shopping</p>
                        <button class="cta-btn">立即购买 / Buy Now</button>
                    </div>
                </div>
                <div class="slide">
                    <div class="slide-content">
                        <h2>新品上市 / New Arrivals</h2>
                        <p>最新商品抢先体验 / Experience the latest products first</p>
                        <button class="cta-btn">查看详情 / View Details</button>
                    </div>
                </div>
                <div class="slide">
                    <div class="slide-content">
                        <h2>限时优惠 / Limited Time Offers</h2>
                        <p>超值折扣，错过再等一年 / Great discounts, don't miss out</p>
                        <button class="cta-btn">立即抢购 / Shop Now</button>
                    </div>
                </div>
            </div>
            <div class="slider-dots">
                <span class="dot active" data-slide="0"></span>
                <span class="dot" data-slide="1"></span>
                <span class="dot" data-slide="2"></span>
            </div>
        </section>

        <!-- 商品分类 -->
        <section class="categories-section">
            <div class="container">
                <h2 class="section-title">商品分类</h2>
                <div class="categories-grid">
                    <div class="category-card" data-category="Food">
                        <i class="fas fa-utensils"></i>
                        <h3>食品 / Food</h3>
                        <p>新鲜美味，健康生活</p>
                    </div>
                    <div class="category-card" data-category="Clothing">
                        <i class="fas fa-tshirt"></i>
                        <h3>服装 / Clothing</h3>
                        <p>时尚潮流，个性搭配</p>
                    </div>
                    <div class="category-card" data-category="Book">
                        <i class="fas fa-book"></i>
                        <h3>图书 / Books</h3>
                        <p>知识海洋，智慧人生</p>
                    </div>
                    <div class="category-card" data-category="Electronic Products">
                        <i class="fas fa-laptop"></i>
                        <h3>电子产品</h3>
                        <p>科技前沿，智能生活</p>
                    </div>
                    <div class="category-card" data-category="Daily product">
                        <i class="fas fa-home"></i>
                        <h3>日用品</h3>
                        <p>生活必备，品质之选</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- 推荐商品 -->
        <section class="recommended-section">
            <div class="container">
                <h2 class="section-title">推荐商品</h2>
                <div class="products-grid" id="recommendedProducts">
                    <!-- 推荐商品将通过JavaScript动态加载 -->
                </div>
                <div class="load-more">
                    <button class="btn btn-outline" id="loadMoreBtn">加载更多</button>
                </div>
            </div>
        </section>

        <!-- 热门商品 -->
        <section class="trending-section">
            <div class="container">
                <h2 class="section-title">热门商品</h2>
                <div class="products-grid" id="trendingProducts">
                    <!-- 热门商品将通过JavaScript动态加载 -->
                </div>
            </div>
        </section>
    </main>

    <!-- 页脚 -->
    <footer class="footer">
        <div class="container">
            <div class="footer-content">
                <div class="footer-section">
                    <h3>关于我们</h3>
                    <p>阿里宝宝致力于为用户提供优质的购物体验</p>
                </div>
                <div class="footer-section">
                    <h3>客户服务</h3>
                    <ul>
                        <li><a href="#">帮助中心</a></li>
                        <li><a href="#">联系客服</a></li>
                        <li><a href="#">意见反馈</a></li>
                    </ul>
                </div>
                <div class="footer-section">
                    <h3>购物指南</h3>
                    <ul>
                        <li><a href="#">购物流程</a></li>
                        <li><a href="#">配送说明</a></li>
                        <li><a href="#">退换货政策</a></li>
                    </ul>
                </div>
                <div class="footer-section">
                    <h3>关注我们</h3>
                    <div class="social-links">
                        <a href="credits.html" class="credits-link"><i class="fab fa-weixin"></i></a>
                        <a href="credits.html" class="credits-link"><i class="fab fa-weibo"></i></a>
                        <a href="credits.html" class="credits-link"><i class="fab fa-qq"></i></a>
                    </div>
                </div>
            </div>
            <div class="footer-bottom">
                <p>&copy; 2024 阿里宝宝电商平台. All rights reserved.</p>
            </div>
        </div>
    </footer>

    <!-- 登录 / Login/注册 / Register模态框 -->
    <div class="modal" id="authModal">
        <div class="modal-content">
            <div class="modal-header">
                <h2 id="modalTitle">用户登录 / Login</h2>
                <span class="close" id="closeModal">&times;</span>
            </div>
            <div class="modal-body">
                <form id="authForm">
                    <div class="form-group">
                        <label for="username">用户名</label>
                        <input type="text" id="username" name="username" required>
                    </div>
                    <div class="form-group">
                        <label for="password">密码</label>
                        <input type="password" id="password" name="password" required>
                    </div>
                    <div class="form-group" id="emailGroup" style="display: none;">
                        <label for="email">邮箱</label>
                        <input type="email" id="email" name="email">
                    </div>
                    <div class="form-group" id="phoneGroup" style="display: none;">
                        <label for="phone">手机号</label>
                        <input type="tel" id="phone" name="phone">
                    </div>
                    <div class="form-group" id="shopNameGroup" style="display: none;">
                        <label for="shopName">店铺名称</label>
                        <input type="text" id="shopName" name="shopName">
                    </div>
                    <div class="form-group" id="userTypeGroup" style="display: none;">
                        <label for="userType">用户类型</label>
                        <select id="userType" name="userType">
                            <option value="Customer">买家</option>
                            <option value="Seller">卖家</option>
                        </select>
                    </div>
                    <button type="submit" class="btn btn-primary" id="submitBtn">登录 / Login</button>
                </form>
                <div class="auth-switch">
                    <p id="switchText">还没有账号？<a href="#" id="switchLink">立即注册 / Register</a></p>
                </div>
            </div>
        </div>
    </div>

    <!-- 折扣游戏弹窗 -->
    <div class="modal" id="discountGameModal">
        <div class="modal-content game-modal">
            <div class="modal-header">
                <h2>🎮 折扣游戏</h2>
                <span class="close" id="closeGameModal">&times;</span>
            </div>
            <div class="modal-body">
                <div class="game-container">
                    <div class="game-info">
                        <h3>贪吃蛇游戏</h3>
                        <p>控制蛇吃食物，获得分数换取折扣！</p>
                        <div class="score-display">
                            <span>当前分数: </span>
                            <span id="gameScore">0</span>
                        </div>
                        <div class="discount-info">
                            <span>可获得折扣: </span>
                            <span id="discountPercent">0%</span>
                        </div>
                    </div>
                    <div class="game-board">
                        <canvas id="gameCanvas" width="400" height="400"></canvas>
                        <div class="game-controls">
                            <button id="startGame" class="btn btn-primary">开始游戏</button>
                            <button id="pauseGame" class="btn btn-secondary" disabled>暂停</button>
                            <button id="resetGame" class="btn btn-outline">重新开始</button>
                        </div>
                        <div class="game-instructions">
                            <p>使用方向键控制蛇的移动</p>
                            <p>吃到食物获得分数，避免撞墙或撞到自己</p>
                        </div>
                    </div>
                </div>
                <div class="game-result" id="gameResult" style="display: none;">
                    <h3>游戏结束！</h3>
                    <p>最终分数: <span id="finalScore">0</span></p>
                    <p>获得折扣: <span id="finalDiscount">0%</span></p>
                    <button id="applyDiscount" class="btn btn-success">应用折扣</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 加载提示 -->
    <div class="loading" id="loading">
        <div class="loading-spinner"></div>
        <p>加载中... / Loading...</p>
    </div>

    <!-- 通知提示 -->
    <div class="notification" id="notification">
        <div class="notification-content">
            <i class="fas fa-check-circle"></i>
            <span id="notificationText">操作成功</span>
        </div>
    </div>

    <!-- JavaScript文件 -->
    <script src="js/api.js"></script>
    <script src="js/auth.js"></script>
    <script src="js/cart.js"></script>
    <script src="js/product.js"></script>
    <script src="js/game.js"></script>
    <script src="js/main.js"></script>
</body>
</html>
